<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>登陆-网站名称</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link href="/static/layui/css/layui.css" media="all" rel="stylesheet">
  <link href="/static/layui/css/admin.css" media="all" rel="stylesheet">
  <link href="/static/layui/css/login.css" media="all" rel="stylesheet">
</head>
<body>
<form  class="layui-form" action="" lay-filter="component-form-group" onsubmit="return false">
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>后台管理系统</h2>
        <!-- <p></p> -->
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="username" id="username" lay-verify="required" placeholder="用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="password" id="password" lay-verify="required" placeholder="密码" class="layui-input">
        </div>
        <div class="layui-form-item" style="display:" >
          <div class="layui-row">
            <div class="layui-col-xs7">
              <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
              <input type="text" name="vercode" id="LAY-user-login-vercode"  placeholder="图形验证码" class="layui-input">
            </div>
            <div class="layui-col-xs5">
              <div style="margin-left: 10px;">
                <img src="{{get_url('admin.index.captcha')}}" class="layadmin-user-login-codeimg" id="vercode">
              </div>
            </div>
          </div>
        </div>

        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit=""  lay-filter="LAY-user-login-submit">登 陆</button>
        </div>

      </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">

      <p>© 2024 <a href="####" target="_blank">Copyrights © xxx  All rights reserved. </a></p>

    </div>



  </div></form>

<script src="/static/layui/layui.js"></script>
<script>
  layui.use(['form', 'laydate', 'util'], function(){
      var $ = layui.$
       ,form = layui.form
       ,router = layui.router()


    form.render(null, 'component-form-group');


    $('#vercode').on('click', function () {
      this.src='{{get_url('admin.index.captcha')}}?s'+Math.random();
    });
    //提交
    form.on('submit(LAY-user-login-submit)', function(data){

      $.post("{{get_url('admin.index.login')}}", data.field ,
              function(data){
              console.log(data)
                parent.layer.alert(data.msg);
                if(data.code==200){
                  parent.window.location='{{get_url('admin.index.index')}}';
                }else{
                  console.log('....')
                  $('#vercode').attr('src',"{{get_url('admin.index.captcha')}}?s"+Math.random()+'"');
                }
              }
      );

      return false;

    });




  });
</script>
</body>
</html>